#!/bin/bash

# create shared folder for root agent socket
mkdir -p -m 777 shared/rootSocket

# create shared folder for intermediateA agent socket
mkdir -p -m 777 shared/intermediateASocket

# create shared folder for intermediateB agent socket
mkdir -p -m 777 shared/intermediateBSocket

# root certificates
"${ROOTDIR}/setup/x509pop/setup.sh" root/server root/agent

# intermediateA certificates
"${ROOTDIR}/setup/x509pop/setup.sh" intermediateA/server intermediateA/agent

# leafA certificates
"${ROOTDIR}/setup/x509pop/setup.sh" leafA/server leafA/agent

# intermediateB certificates
"${ROOTDIR}/setup/x509pop/setup.sh" intermediateB/server intermediateB/agent

# leafB certificates
"${ROOTDIR}/setup/x509pop/setup.sh" leafB/server leafB/agent

docker build --target nested-agent-alpine -t nested-agent-alpine .
